# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-ldap0
_pkgname=ldap0
pkgver=1.4.10
_pyver=3.13
pkgrel=7
pkgdesc='Module package for implementing LDAP clients.'
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/ldap0/#files'
license=('Apache')
depends=('python' 'python-pyasn1' 'python-pyasn1-modules' 'openldap')
makedepends=('python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('ef4da17e78594ba3761c24ef63a8c6a8194fd4d3b8152006133e26d2c6b6ff164bd5221725bb833f9a469051dfa4aa438f2bfa3fab4e3f74721d8a626e39ff77')

prepare() {
  cd "$_pkgname-$pkgver"

  sed -i 's|libs = ldap_r|libs = ldap|g' setup.cfg
}

build() {
  cd "$_pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  chmod 644 \
    "$pkgdir/usr/lib/python$_pyver/site-packages/ldap0-$pkgver-py$_pyver.egg-info/"*
}

